Option Strict Off
Option Explicit On
<System.Runtime.InteropServices.ProgId("clsIniFile_NET.clsIniFile")> Public Class clsIniFile
	'UPGRADE_ISSUE: Declaring a parameter 'As Any' is not supported. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="FAE78A8D-8978-4FD4-8208-5B7324A8F795"'
    Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Integer, ByVal lpFileName As String) As Integer
	Private Declare Function GetPrivateProfileSection Lib "kernel32"  Alias "GetPrivateProfileSectionA"(ByVal lpAppName As String, ByVal lpReturnedString As String, ByVal nSize As Integer, ByVal lpFileName As String) As Integer
	
	'UPGRADE_ISSUE: Declaring a parameter 'As Any' is not supported. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="FAE78A8D-8978-4FD4-8208-5B7324A8F795"'
	'UPGRADE_ISSUE: Declaring a parameter 'As Any' is not supported. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="FAE78A8D-8978-4FD4-8208-5B7324A8F795"'
    Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpString As String, ByVal lpFileName As String) As Integer
	Private Declare Function WritePrivateProfileSection Lib "kernel32"  Alias "WritePrivateProfileSectionA"(ByVal lpAppName As String, ByVal lpString As String, ByVal lpFileName As String) As Integer
	
	Private Const BufferSize As Integer = 4096
	
	Private strIniFile As String
	
	
	Public Property File() As String
		Get
			File = strIniFile
		End Get
		Set(ByVal Value As String)
			strIniFile = Value
		End Set
	End Property
	
	Public Function GetValue(ByRef strSection As String, ByRef strKey As String) As Object
		Dim strBuffer As String
		Dim lLength As Integer
		
		strBuffer = Space(BufferSize)
		
		lLength = GetPrivateProfileString(strSection, strKey, vbNullString, strBuffer, BufferSize, strIniFile)
		
		GetValue = Left(strBuffer, lLength)
	End Function
	
    Public Sub WriteValue(ByRef strSection As String, ByRef strKey As String, ByRef vntValue As Object)
        'UPGRADE_WARNING: Couldn't resolve default property of object vntValue. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        WritePrivateProfileString(strSection, strKey, CStr(vntValue), strIniFile)
    End Sub
	
	Public Function GetSection(ByRef strSection As String) As Object
		Dim strBuffer As String
		Dim lLength As Integer
		
		strBuffer = Space(BufferSize)
		
		lLength = GetPrivateProfileSection(strSection, strBuffer, BufferSize, strIniFile)
		
		GetSection = Split(Left(strBuffer, lLength), vbNullChar)
	End Function
	
	Public Function GetSectionKeys(ByRef strSection As String) As Object
		Dim strBuffer As String
		Dim lLength As Integer
		
		strBuffer = Space(BufferSize)
		
		lLength = GetPrivateProfileString(strSection, vbNullString, vbNullString, strBuffer, BufferSize, strIniFile)
		
		GetSectionKeys = Split(Left(strBuffer, lLength), vbNullChar)
	End Function
End Class